#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <numeric>

using namespace std;

string s;

void dfs(vector<int> &vis, string &tmp, int first)
{
    if (first == tmp.size())
    {
        cout << tmp << endl;
        return;
    }
    for (int i = 0; i < s.size(); i++)
    {
        if (vis[i] || (i > 0 && s[i] == s[i - 1] && !vis[i - 1]))
            continue;
        tmp[first] = s[i];
        vis[i] = 1;
        dfs(vis, tmp, first + 1);
        vis[i] = 0;
    }
}

int main()
{
    cin >> s;
    sort(s.begin(), s.end());
    vector<int> vis(s.size(), 0);
    string tmp = s;
    dfs(vis, tmp, 0);
    return 0;
}